<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 200px;
            height: 200px;
            position: relative;
            transition: all 3s;
            transform-style: preserve-3d;
            
        }
        .box div{
            width: 200px;
            height: 200px;
            position: absolute;
            background-color: pink;
            transition: all 3s;
            transform-style: preserve-3d;
            box-shadow: 2px 2px 10px black;
            perspective: 1000px;
        }
        .box:hover .box1{
            transform: rotatez(180deg);
        }
        .box:hover .box2{
            transform: rotatex(180deg);
        }
        .box:hover .box3{
            transform: rotatez(-180deg);
        }
        .box:hover .box4{
            transform: rotatey(-180deg);
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
        <div class="box4"></div>
    </div>
</body>
</html>